package com.yycwxt.modules.admin.bcf;

import com.yycwxt.common.ReturnResult;
import com.yycwxt.domain.Bcf;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;


/**
 * Created by Mr.Zhang on 2022/9/2 16:12
 */
@RestController
@Validated
@Api("包材费用接口文档")
@RequestMapping("/bcf")
public class BcfController {

    private final BcfService bcfService;

    public BcfController(@Autowired BcfService bcfService) {
        this.bcfService = bcfService;
    }

    // 根据账期查询全部
    @GetMapping("/{zq}")
    @ApiOperation("根据账期查询包材费")
    public ReturnResult selectBcf(@ApiParam(name = "zq", required = true, type = "int") @PathVariable int zq) {
        return ReturnResult.buildSuccessResult(bcfService.selectBcf(zq));
    }

    // 查询账期
    @GetMapping("/account_date")
    @ApiOperation("查询全部账期")
    public ReturnResult selectZq() {
        return ReturnResult.buildSuccessResult(bcfService.selectZq());
    }

    // 查询下载文件地址
    @GetMapping("/getUrl")
    @ApiOperation("获取包材费用文件的URL")
    public ReturnResult getUrl(){
        return ReturnResult.buildSuccessResult(bcfService.getUrl());
    }


    // 调用存储过程
    //@GetMapping("/Bcf/{zq}")
    //@ApiOperation("根据账期调用存储过程插入表")
    //public ReturnResult generateBcf(@ApiParam(name = "zq", required = true, type = "int") @PathVariable int zq) {
    //    bcfService.generateBcf(zq);
    //    return ReturnResult.buildSuccessResult(null);
    //}




}
